Add biometric sign-in and settings test coverage#717
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f45c1498f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| CountingIdlingRes.increment() | ||
| mutableStateFlow.value = SignInResult.ShowProgress | ||
| try { | ||
| when (val result = biometricAuthenticator.authenticate()) { |
There was a problem hiding this comment.
Catch exceptions from biometric authentication
signInWithBiometric() only handles BiometricAuthResult.Error, but biometricAuthenticator.authenticate() itself is not wrapped in a catch. If a platform authenticator throws (for example, prompt/runtime failures), the exception escapes viewModelScope and can crash the sign-in flow instead of showing the existing error dialog path used by password sign-in. Please catch thrown exceptions around authenticate() and route them through the same error handling path.
Useful? React with 👍 / 👎.
Motivation
Description
BiometricAuthenticatorandBiometricAuthResulttopresentation.signinand wire aOnBiometricSignInClickaction intoSignInViewModelwithsignInWithBiometric()handling success, cancel and error paths, and exposingisBiometricAvailablefor the UI.BiometricSettingsGatewayand integrate it intoSettingsViewModelwith aToggleBiometricaction andbiometricSupported/biometricEnabledfields onSettingsResultfor state propagation.SIGN_IN_BIOMETRIC_BUTTON_TAG) to the sign-in UI (SignInScreen) and update shared Koin modules to provide no-op implementations so existing app wiring stays functional without platform biometric implementations.core/presentation/src/androidHostTest(SignInViewModelTest,SettingsViewModelTest) covering biometric success/cancel/error/fallback and settings enable/disable/unsupported-device behavior, and a JVM Compose UI test incore/ui/src/jvmTest(SignInScreenBiometricTest) covering biometric button visibility and fallback UX preservation.Testing
SignInViewModelTest(biometric success/cancel/error/fallback),SettingsViewModelTest(biometric enable/disable lifecycle and unsupported-device behavior), andSignInScreenBiometricTest(UI visibility and password UX preservation)../gradlew :core:presentation:androidHostTest :core:ui:jvmTest --no-daemonbut the build failed in this environment due to a plugin resolution error fororg.gradle.kotlin.kotlin-dsl(plugin artifact could not be resolved), so tests were not run here.core/presentation/src/androidHostTestandcore/ui/src/jvmTestso they will run in CI or a developer environment where Gradle can resolve plugins and device/emulator requirements are met.Codex Task